public class Test5 {
    public static void main(String[] args) {
        int n=3;
        hanoi(n,'A','C','B');
    }
    public static void hanoi(int n,char from,char to,char aux){
        if(n==1){
            System.out.println(from+"  "+to);
            return;
        }
        hanoi(n-1,from,aux,to);
        System.out.println(n+"  "+from+"  "+to);
        hanoi(n-1,aux,to,from);
    }
}
